import req from '@/utils/request'

/** ------------------------------1.登录请求------------------------------------ */
export function checkLogin(params) {
  return req.post('/users/checkLogin', params)
}
/** ------------------------------2.添加账号------------------------------------ */
/**
 *
 * @param {String} account
 * @param {String} password
 * @param {String} userGroup 用户组
 */
export function addAccount(params) {
  return req.post('/users/add', params)
}
/** ------------------------------3.获取账号列表------------------------------------ */
/**
 *
 * @param {Number} currentPage --当前页
 * @param {Number} pageSize------每页条数
 */
export function getAccountList(params) {
  return req.get('/users/list', params)
}
/** ------------------------------4.删除账号------------------------------------ */
/**
 *
 * @param {Number} id
 */
export function delAccount(params) {
  return req.get('/users/del', params)
}
/** ------------------------------5.批量删除账号------------------------------------ */
/**
 *
 * @param {Array} ids [76,75]---字符数组
 */
export function delAccountList(params) {
  console.log(params)
  return req.get('/users/batchdel', params)
}

/** ------------------------------6.修改账号------------------------------------ */
/**
 *
 * @param {Number} id
 * @param {String} account
 * @param {String} userGroup
 */
export function updateAccount(params) {
  return req.post('/users/edit', params)
}

/** ------------------------------7.检查旧密码是否正确------------------------------------ */
/**
 * @param {String} oldPwd
 */
export function checkOldPwd(params) {
  return req.get('/users/checkoldpwd', params)
}

/** ------------------------------8.修改密码------------------------------------ */
/**
 * @param {String} newPwd
 */
export function updatePwd(params) {
  return req.post('/users/editpwd', params)
}

/** ------------------------------9.获取账号信息（个人中心）------------------------------------ */

export function getUserInfo() {
  return req.get('/users/info')
}
/** ------------------------------10.头像上传接口------------------------------------ */
/**
 * @param {binary} file 二进制数据流
 */
export function uploadAvatar(params) {
  return req.post('/users/avatar_upload', params)
}
/** ------------------------------11.修改用户头像------------------------------------ */
/**
 * @param {String} newPwd
 */
export function updateAvatar(params) {
  return req.get('/users/avataredit', params)
}
